import React, { Component } from 'react'
import { connect } from 'react-redux'
import axios from "axios"
class list extends Component {
  constructor(props) {
    super(props)
    this.state = {
      arr: []
    }
  }
   ck = () => {
     this.props.ck1("商品列表")
   }
   componentDidMount() {
     axios.get("/shopList.json").then((data) => {
       console.log(data.data)
       this.setState({
         arr: data.data
       })
     })
   }
  render() {
    return (
      <div>
         <table style={{width:"1600px"}} >
                <thead>
                    <th>商品名称</th>
                    <th>店铺地址</th>
                </thead>
                <tbody>
                {
                    this.state.arr.map((v, i) => {
                        return <tr key={i}>
                            <td>{v.name}</td>
                            <td>{v.address}</td>
                            <td>{v.id}</td>
                        </tr>
                    })
                }
                </tbody>
               
            </table>
      </div>
    )
  }
}
function mapStateToProps (state) {
  return {
    
  }
}
function mapDispatchToProps (dispatch) {
  return {
    
  }
}
export default connect(mapStateToProps, mapDispatchToProps)(list)